import pandas as pd #导入pandas
import numpy as np

# df = pd.read_excel('../datafile/课程.xlsx')
# pd.set_option('display.unicode.east_asian_width', True)
# print(df)
# print(df.info())#查看是否有缺失
# print(df.isnull())
# df =  df.dropna()
# print(df)
# print(df[df['课程总数量'].notnull()])
# df['课程总数量'] = df['课程总数量'].fillna(0)
# print(df)
# print(df.drop_duplicates())#删除重复数据

# df = df.drop_duplicates(['买家实际支付金额'],keep='last')
# print(df)

# df1 = df.drop_duplicates(['买家实际支付金额'],inplace=False)
# print(df1)

# s1 = pd.Series([10,20,30],index=['a','b','c'])
# print(s1)
#
# s2 = pd.Series([2,3,4],index=['a','b','c'])
# print(s1+s2)


s = pd.Series([11,22,33],index=[1,2,3])
# print(s.reindex(range(1,6)))

# print(s.reindex(range(1,6),fill_value=0))

# print(s.reindex(range(1,6),method='ffill'))#向前填充

# print(s.reindex(range(1,6),method='bfill'))#向后填充


# arr = np.array([[1,4,1,4],[2,3,np.nan,4],[2,np.nan,np.nan,7],[3,5,np.nan,2],[4,2,3,5]])
# dfx = pd.DataFrame(arr, columns=pd.MultiIndex.from_product([['bar','zoo'],['one','two']]))
# # print(dfx.to_string())
#
# dfx1 =dfx.fillna(method='ffill')
# print(dfx1.to_string())

# data = [[90,100,90],[100,39,89],[49,79,87]]
# index = ['msb1001','msb1002','msb1003']
# columns = ['数学','语文','英语']
# pd.set_option('display.unicode.east_asian_width', True)
# df = pd.DataFrame(data=data,index=index,columns=columns)
# print(df)

# print(df.reindex(['msb1001','msb1002','msb1003','msb1004','msb1005']))
# print(df.reindex(columns=['数学','语文','英语','政治','历史']))

# print(df.reindex(index=['msb1001','msb1002','msb1003','msb1004','msb1005'],columns=['数学','语文','英语','政治','历史'],fill_value=0))

df = pd.read_excel('../datafile/课程.xlsx')
pd.set_option('display.unicode.east_asian_width', True)
# df = df.set_index(['买家会员名'])
# print(df)

df = df.dropna().reset_index(drop=True)
print(df)
